package com.ziq.zcamp.place

import android.graphics.Color
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.ziq.base.extension.BindingViewHolder
import com.ziq.base.extension.createBindingViewHolder
import com.ziq.zcamp.databinding.ItemCarParameterBinding

class CarParametersAdapter(val list: List<CampParametersItem>) : RecyclerView.Adapter<BindingViewHolder<ItemCarParameterBinding>>(){

        override fun getItemCount(): Int {
            return list.size
        }

        override fun onCreateViewHolder(
            parent: ViewGroup,
            viewType: Int
        ): BindingViewHolder<ItemCarParameterBinding> {
            return createBindingViewHolder(parent)
        }

        override fun onBindViewHolder(
            holder: BindingViewHolder<ItemCarParameterBinding>,
            position: Int
        ) {
            val item = list[position]
            holder.binding.image.setImageURI(item.icon)
            holder.binding.text.text = item.text
            holder.binding.text.setTextColor(if (item.available == 1) Color.parseColor("#6E5F55") else Color.parseColor("#C5BFBB"))
        }
    }